package com.zxjbyte.yiyi.server.domain.param;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.zxjbyte.yiyi.framework.common.constant.Constant;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.Date;

/**
 * @Author zhangxingjia
 * @Date 2023/3/1 19:14
 * @Version: 1.0
 */
@Getter
@Setter
@Schema(description = "post方式请求结构体")
public class DemoPostBodyParam {

    @Schema(description = "id", required = true)
    private Long id;

    @Schema(description = "名字", required = true)
    private String name;

    @Schema(description = "时间", required = false)
    @JsonFormat(pattern = "yyyy/MM/dd HH:mm:ss", timezone = "GMT+8")
    private Date date;

    @Schema(description = "时间3", required = false)
    private Date date3;

    // 配置@JsonFormat自定义类型，不配置使用全局默认序列化处理
    @Schema(description = "java8时间", required = true)
    @JsonFormat(pattern = Constant.PATTERN_DATETIME, timezone = "GMT+8")
    private LocalDateTime localDateTime;

    @Schema(description = "时间年月日", required = false)
    @JsonFormat(pattern = Constant.PATTERN_DATE, timezone = "GMT+8")
    private Date date2;

    @Schema(description = "java8时间年月日", required = true)
    @JsonFormat(pattern = Constant.PATTERN_DATE, timezone = "GMT+8")
    private LocalDate localDate;

    @Schema(description = "java8时间时分秒", required = true, type = "string")
    @JsonFormat(pattern = Constant.PATTERN_TIME, timezone = "GMT+8")
    private LocalTime localTime;
}
